const http = require("http");
const routes = require("./module/routes")
// 端口
const port = 4000
// 创建服务器
http.createServer((req, res) => {
    if (req.url != '/favicon.ico') {
        // 静态服务器
        routes.static(req, res, './static')
        // 动态路由
        let path = req.url.replace("/", "")
        try {
            routes[path](req, res)
        } catch (err) {
            routes["error"](req, res)
        }
    }
}).listen(port)